﻿<navigation:Page x:Class="TimeSheetReporting.Home" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:riaControl="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Ria"
    xmlns:src="clr-namespace:TimeSheetReporting.Helper"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    Title="Home"
    Style="{StaticResource PageStyle}">

  <Grid x:Name="LayoutRoot">
    <Grid.Resources>
      <src:MemberListProvider x:Key="memberListProvider" />
      <src:ProjectListProvider x:Key="projectListProvider" />
    </Grid.Resources>
    <Border Style="{StaticResource ContentBoxStyle}">
      <Grid>
        <data:DataGrid x:Name="gridEfforts" AutoGenerateColumns="False" Margin="0,0,0,30" >
          <data:DataGrid.Columns>
            <data:DataGridTemplateColumn Header="Date">
              <data:DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                  <controls:DatePicker  SelectedDate="{Binding Date,Mode=TwoWay}"/>
                </DataTemplate>
              </data:DataGridTemplateColumn.CellTemplate>
            </data:DataGridTemplateColumn>
            <data:DataGridTemplateColumn Header="Member">
              <data:DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                  <TextBlock Text="{Binding Member.Name}" />
                </DataTemplate>
              </data:DataGridTemplateColumn.CellTemplate>
              <data:DataGridTemplateColumn.CellEditingTemplate>
                <DataTemplate>
                  <ComboBox ItemsSource="{Binding MemberList,Source={StaticResource memberListProvider}}" 
                            SelectedItem="{Binding Member,Mode=TwoWay}"
                            DisplayMemberPath="Name" />
                </DataTemplate>
              </data:DataGridTemplateColumn.CellEditingTemplate>
            </data:DataGridTemplateColumn>
            <data:DataGridTemplateColumn Header="Project" >
              <data:DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                  <TextBlock Text="{Binding Project.Name}" />
                </DataTemplate>
              </data:DataGridTemplateColumn.CellTemplate>
              <data:DataGridTemplateColumn.CellEditingTemplate>
                <DataTemplate>
                  <ComboBox ItemsSource="{Binding ProjectList,Source={StaticResource projectListProvider}}"
                            SelectedItem="{Binding Project,Mode=TwoWay}"
                            DisplayMemberPath="Name" />
                </DataTemplate>
              </data:DataGridTemplateColumn.CellEditingTemplate>
            </data:DataGridTemplateColumn>
            <data:DataGridTemplateColumn Header="Hours">
              <data:DataGridTemplateColumn.CellTemplate >
                <DataTemplate>
                  <TextBox Text="{Binding Hours,Mode=TwoWay}"/>
                </DataTemplate>
              </data:DataGridTemplateColumn.CellTemplate>
            </data:DataGridTemplateColumn>
            <data:DataGridTemplateColumn Header="Description">
              <data:DataGridTemplateColumn.CellTemplate >
                <DataTemplate>
                  <TextBox Text="{Binding Description,Mode=TwoWay}"/>
                </DataTemplate>
              </data:DataGridTemplateColumn.CellTemplate>
            </data:DataGridTemplateColumn>
          </data:DataGrid.Columns>
        </data:DataGrid>
      </Grid>
    </Border>


    <Border Style="{StaticResource ToolBoxStyle}">
      <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" >
        <Button x:Name="BtnSave" Content="Save" Margin="5,0,0,0" Style="{StaticResource BtnSaveStyle}"  Click="BtnSave_Click" />
        <Button x:Name="BtnAdd" Content="Add" Margin="5,0,0,0" Style="{StaticResource BtnAddStyle}" Click="BtnAdd_Click"/>
        <Button x:Name="BtnDelete" Content="Delete" Margin="5,0,0,0" Style="{StaticResource BtnDeleteStyle}" Click="BtnDelete_Click"/>
      </StackPanel>
    </Border>
  </Grid>

</navigation:Page>